package com.ponhu.ea2.enums;

/**
 * 值输入方式枚举类
 *
 * @author zhaokai
 */
public enum InputMethodTypeEnum {

    /**
     * 单行文本框
     */
    INPUT(1, "单行文本框"),

    /**
     * 下拉单选
     */
    SELECT(2, "下拉单选"),

    /**
     * 单选
     */
    RADIO(3, "单选"),

    /**
     * 复选
     */
    CHECKBOX(4, "复选"),

    /**
     * 多行文本框
     */
    TEXTAREA(5, "多行文本框"),

    /**
     * 下拉多选
     */
    MULTIPLE_SELECT(6, "下拉多选"),
    ;

    private Integer code;

    private String name;

    InputMethodTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static InputMethodTypeEnum getInputMethodType(Integer code){
        if(code == null){
            return null;
        }
        for (InputMethodTypeEnum c : InputMethodTypeEnum.values()) {
            if (code.equals(c.getCode())) {
                return c;
            }
        }
        return null;
    }
}
